perm filename MIDTER.F75[206,LSP] blob sn#185965 filedate 1975-11-13 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	.device xgp
C00005 ENDMK
C⊗;
.device xgp
.font 1 "basl30" <<text>>
.font 2 "bdr30" <<sym>>
.font 3 "basi30" <<var>>
.font 4 "basb30" <<bold>>
.evenleftborder←oddleftborder←1100;
.page frame 52 high 79 wide;
.area text lines 1 to 51 chars 1 to 79;
.place text;
.TURN ON "←%";
.NOFILL
←COMPUTER SCIENCE DEPARTMENT
←STANFORD UNIVERSITY



←CS 206         COMPUTING WITH SYMBOLIC EXPRESSIONS        FALL 1975
←MIDTERM EXAM

%1←Open Books and Notes




.FILL
	Write  LISP  functions  as  follows  using  the  M-expression
notation used in class:
.SKIP 2
1. %3foo u%1 is a list consisting of the atomic elements of the list %3u%1
followed by the non-atomic elements preserving order within each group.
Thus

	%3foo%1[(A (B C) A B (D E))] = (A A B (B C) (D E)))


2. Let a polynomial in %3x%1 be represented by a list of its coefficients
in order of ascending powers of %3x%1.  Thus %3x%53%3+x+5%1 is represented
by (5 1 0 1).  %3prod(u,v)%1 gives the product of the polynomials %3u%1
and %3v%1 in the same notation.


3. %3commons u%1 is a list of the sublists of the list %3u%1 that occur
more than once in %3u%1 each followed by a list of the locations where
it occurs.  The location of a sub expression is a list of A's and D's
such that starting a the beginning of

4. %3locations%2[%3e,u%2]%1 is a list of the locations of the occurences
of the expression %3e%1 as a subexpression of the expression %3u%1.  A
location is a list of A's and D's such that %3e%1 is reached by taking